package base.thread_JUC2.chapter01.demo005;

import java.time.LocalDateTime;
import java.util.concurrent.TimeUnit;

public class FileClock implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.printf("%s: %s\n", Thread.currentThread().getName(), LocalDateTime.now());
            try {
                TimeUnit.SECONDS.sleep(2);
            } catch (InterruptedException e) {
                System.out.printf("%s: The FileClock has been interrupted\n", Thread.currentThread().getName()+"_"+i);
            }
        }
    }
}
